package p270jp.pxv.android.notification.presentation.activity;

import android.app.Activity;
import android.content.ComponentCallbacks;
import android.os.Bundle;
import android.support.p024v4.media.C0261e;
import android.view.MenuItem;
import android.view.View;
import androidx.compose.p026ui.platform.C0536v1;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.MaterialToolbar;
import java.util.Date;
import java.util.Objects;
import p014ae.C0146r;
import p047bg.C1124a;
import p056bp.ZoneId;
import p064c6.Preconditions;
import p108di.RecyclerViewEndlessScrollListener;
import p134ei.AnalyticsScreenName;
import p184gi.ScreenView;
import p189gn.AbstractC3435a;
import p211hi.FirebaseAnalyticsAction;
import p216hn.Lambda;
import p216hn.Reflection;
import p258jd.SingleDoOnSuccess;
import p258jd.SingleFlatMap;
import p265jk.ActivityPixivNotificationsViewMoreBinding;
import p265jk.ListItemNotificationItemBinding;
import p265jk.ListItemNotificationItemNewBinding;
import p270jp.pxv.android.R;
import p270jp.pxv.android.commonObjects.model.Notification;
import p290kk.C4546e;
import p290kk.NotificationsRepository;
import p310lc.C4621b;
import p325m0.MutabilityOwnership;
import p337mc.GroupieAdapter;
import p364nc.BindableItem;
import p372nk.AbstractActivityC5379f;
import p372nk.C5385q;
import p393of.C5453b;
import p393of.PixivDateTimeFormatter;
import p398ok.NotificationsDividerItemDecoration;
import p425pk.C5651u;
import p425pk.C5656z;
import p425pk.PixivNotificationsViewMoreAction;
import p425pk.PixivNotificationsViewMoreActionCreator;
import p425pk.PixivNotificationsViewMoreStore;
import p467rd.subscribers;
import p579vo.Qualifier;
import p593wc.Single;
import p603wm.AbstractC6949c;
import p625xi.LegacyNavigation;
import p645yc.AndroidSchedulers;
import p671zc.CompositeDisposable;
import p671zc.Disposable;
import p677zi.PixivImageLoader;

/* compiled from: PixivNotificationsViewMoreActivity.kt */
/* renamed from: jp.pxv.android.notification.presentation.activity.PixivNotificationsViewMoreActivity */
/* loaded from: classes2.dex */
public final class PixivNotificationsViewMoreActivity extends AbstractActivityC5379f {

    /* renamed from: I */
    public static final /* synthetic */ int f19220I;

    /* renamed from: E */
    public PixivDateTimeFormatter f19225E;

    /* renamed from: F */
    public NotificationsDividerItemDecoration f19226F;

    /* renamed from: H */
    public RecyclerViewEndlessScrollListener f19228H;

    /* renamed from: v */
    public final AbstractC6949c f19229v = Preconditions.m9802P(1, new C4297d(this, null, null));

    /* renamed from: w */
    public final AbstractC6949c f19230w = C4621b.m3851a(this, C4296c.f19243c);

    /* renamed from: x */
    public final AbstractC6949c f19231x = Preconditions.m9802P(1, new C4298e(this, null, null));

    /* renamed from: y */
    public final AbstractC6949c f19232y = Preconditions.m9802P(1, new C4299f(this, null, null));

    /* renamed from: z */
    public final AbstractC6949c f19233z = Preconditions.m9802P(1, new C4300g(this, null, null));

    /* renamed from: A */
    public final AbstractC6949c f19221A = Preconditions.m9801Q(new C4301h(this, "title"));

    /* renamed from: B */
    public final AbstractC6949c f19222B = Preconditions.m9801Q(new C4302i(this, "notification_id"));

    /* renamed from: C */
    public final GroupieAdapter f19223C = new GroupieAdapter();

    /* renamed from: D */
    public final CompositeDisposable f19224D = new CompositeDisposable();

    /* renamed from: G */
    public final LinearLayoutManager f19227G = new LinearLayoutManager(1, false);

    /* compiled from: PixivNotificationsViewMoreActivity.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.PixivNotificationsViewMoreActivity$a */
    /* loaded from: classes2.dex */
    public static final class C4294a extends BindableItem<ListItemNotificationItemNewBinding> {
        @Override // p337mc.Item
        /* renamed from: b */
        public int mo3603b() {
            return R.layout.list_item_notification_item_new;
        }

        @Override // p364nc.BindableItem
        /* renamed from: e */
        public void mo3420e(ListItemNotificationItemNewBinding eVar, int i) {
            MutabilityOwnership.m3745m(eVar, "viewBinding");
        }

        @Override // p364nc.BindableItem
        /* renamed from: f */
        public ListItemNotificationItemNewBinding mo3419f(View view) {
            MutabilityOwnership.m3745m(view, "view");
            return ListItemNotificationItemNewBinding.m4876a(view);
        }
    }

    /* compiled from: PixivNotificationsViewMoreActivity.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.PixivNotificationsViewMoreActivity$b */
    /* loaded from: classes2.dex */
    public static final class C4295b extends BindableItem<ListItemNotificationItemBinding> {

        /* renamed from: l */
        public static final /* synthetic */ int f19234l;

        /* renamed from: d */
        public final PixivImageLoader f19235d;

        /* renamed from: e */
        public final PixivDateTimeFormatter f19236e;

        /* renamed from: f */
        public final C5656z f19237f;

        /* renamed from: g */
        public final Notification f19238g;

        /* renamed from: h */
        public final String f19239h;

        /* renamed from: i */
        public final String f19240i;

        /* renamed from: j */
        public final String f19241j;

        /* renamed from: k */
        public final String f19242k;

        public C4295b(PixivImageLoader aVar, PixivDateTimeFormatter cVar, C5656z zVar, Notification notification) {
            MutabilityOwnership.m3745m(aVar, "pixivImageLoader");
            MutabilityOwnership.m3745m(zVar, "actionCreator");
            MutabilityOwnership.m3745m(notification, "notification");
            this.f19235d = aVar;
            this.f19236e = cVar;
            this.f19237f = zVar;
            this.f19238g = notification;
            this.f19239h = notification.getContent().getLeftIcon();
            this.f19240i = notification.getContent().getLeftImage();
            this.f19241j = notification.getContent().getText();
            Date createdDatetime = notification.getCreatedDatetime();
            Date date = new Date();
            ZoneId q = ZoneId.m10004q();
            MutabilityOwnership.m3746l(q, "systemDefault()");
            this.f19242k = cVar.m3257c(date, createdDatetime, q);
        }

        @Override // p337mc.Item
        /* renamed from: b */
        public int mo3603b() {
            return R.layout.list_item_notification_item;
        }

        /* JADX WARN: Removed duplicated region for block: B:20:0x0037  */
        /* JADX WARN: Removed duplicated region for block: B:21:0x0039  */
        /* JADX WARN: Removed duplicated region for block: B:30:0x004f  */
        /* JADX WARN: Removed duplicated region for block: B:31:0x0067  */
        @Override // p364nc.BindableItem
        /* renamed from: e */
        /* Code decompiled incorrectly, please refer to instructions dump */
        public void mo3420e(p265jk.ListItemNotificationItemBinding r6, int r7) {
            /*
                r5 = this;
                jk.d r6 = (p265jk.ListItemNotificationItemBinding) r6
                java.lang.String r7 = "viewBinding"
                p325m0.MutabilityOwnership.m3745m(r6, r7)
                android.widget.ImageView r7 = r6.f18236c
                java.lang.String r0 = "viewBinding.image"
                p325m0.MutabilityOwnership.m3746l(r7, r0)
                java.lang.String r1 = r5.f19239h
                r2 = 1
                r3 = 0
                if (r1 == 0) goto L_0x001d
                int r1 = r1.length()
                if (r1 != 0) goto L_0x001b
                goto L_0x001d
            L_0x001b:
                r1 = r3
                goto L_0x001e
            L_0x001d:
                r1 = r2
            L_0x001e:
                if (r1 == 0) goto L_0x0032
                java.lang.String r1 = r5.f19240i
                if (r1 == 0) goto L_0x002d
                int r1 = r1.length()
                if (r1 != 0) goto L_0x002b
                goto L_0x002d
            L_0x002b:
                r1 = r3
                goto L_0x002e
            L_0x002d:
                r1 = r2
            L_0x002e:
                if (r1 == 0) goto L_0x0032
                r1 = r2
                goto L_0x0033
            L_0x0032:
                r1 = r3
            L_0x0033:
                r4 = 8
                if (r1 == 0) goto L_0x0039
                r1 = r4
                goto L_0x003a
            L_0x0039:
                r1 = r3
            L_0x003a:
                r7.setVisibility(r1)
                java.lang.String r7 = r5.f19240i
                if (r7 == 0) goto L_0x004a
                int r7 = r7.length()
                if (r7 != 0) goto L_0x0048
                goto L_0x004a
            L_0x0048:
                r7 = r3
                goto L_0x004b
            L_0x004a:
                r7 = r2
            L_0x004b:
                java.lang.String r1 = "viewBinding.root.context"
                if (r7 != 0) goto L_0x0067
                zi.a r7 = r5.f19235d
                androidx.constraintlayout.widget.ConstraintLayout r2 = r6.f18234a
                android.content.Context r2 = r2.getContext()
                p325m0.MutabilityOwnership.m3746l(r2, r1)
                java.lang.String r1 = r5.f19240i
                android.widget.ImageView r3 = r6.f18236c
                p325m0.MutabilityOwnership.m3746l(r3, r0)
                r0 = 15
                r7.m53m(r2, r1, r3, r0)
                goto L_0x008a
            L_0x0067:
                java.lang.String r7 = r5.f19239h
                if (r7 == 0) goto L_0x0073
                int r7 = r7.length()
                if (r7 != 0) goto L_0x0072
                goto L_0x0073
            L_0x0072:
                r2 = r3
            L_0x0073:
                if (r2 != 0) goto L_0x008a
                zi.a r7 = r5.f19235d
                androidx.constraintlayout.widget.ConstraintLayout r2 = r6.f18234a
                android.content.Context r2 = r2.getContext()
                p325m0.MutabilityOwnership.m3746l(r2, r1)
                java.lang.String r1 = r5.f19239h
                android.widget.ImageView r3 = r6.f18236c
                p325m0.MutabilityOwnership.m3746l(r3, r0)
                r7.m60f(r2, r1, r3)
            L_0x008a:
                android.widget.TextView r7 = r6.f18240g
                java.lang.String r0 = r5.f19241j
                android.text.Spanned r0 = android.text.Html.fromHtml(r0)
                r7.setText(r0)
                android.widget.TextView r7 = r6.f18241h
                java.lang.String r0 = r5.f19242k
                r7.setText(r0)
                android.widget.LinearLayout r7 = r6.f18237d
                java.lang.String r0 = "viewBinding.layoutReadMore"
                p325m0.MutabilityOwnership.m3746l(r7, r0)
                r7.setVisibility(r4)
                androidx.constraintlayout.widget.ConstraintLayout r6 = r6.f18234a
                ae.t r7 = new ae.t
                r0 = 21
                r7.<init>(r5, r0)
                r6.setOnClickListener(r7)
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: p270jp.pxv.android.notification.presentation.activity.PixivNotificationsViewMoreActivity.C4295b.mo3420e(c4.a, int):void");
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof C4295b)) {
                return false;
            }
            C4295b bVar = (C4295b) obj;
            return MutabilityOwnership.m3749h(this.f19235d, bVar.f19235d) && MutabilityOwnership.m3749h(this.f19236e, bVar.f19236e) && MutabilityOwnership.m3749h(this.f19237f, bVar.f19237f) && MutabilityOwnership.m3749h(this.f19238g, bVar.f19238g);
        }

        @Override // p364nc.BindableItem
        /* renamed from: f */
        public ListItemNotificationItemBinding mo3419f(View view) {
            MutabilityOwnership.m3745m(view, "view");
            return ListItemNotificationItemBinding.m4877a(view);
        }

        public int hashCode() {
            int hashCode = this.f19236e.hashCode();
            int hashCode2 = this.f19237f.hashCode();
            return this.f19238g.hashCode() + ((hashCode2 + ((hashCode + (this.f19235d.hashCode() * 31)) * 31)) * 31);
        }

        public String toString() {
            StringBuilder c = C0261e.m12042c("NotificationItem(pixivImageLoader=");
            c.append(this.f19235d);
            c.append(", pixivDateTimeFormatter=");
            c.append(this.f19236e);
            c.append(", actionCreator=");
            c.append(this.f19237f);
            c.append(", notification=");
            c.append(this.f19238g);
            c.append(')');
            return c.toString();
        }
    }

    /* compiled from: ComponentCallbackExt.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.PixivNotificationsViewMoreActivity$d */
    /* loaded from: classes2.dex */
    public static final class C4297d extends Lambda implements AbstractC3435a<PixivImageLoader> {

        /* renamed from: a */
        public final /* synthetic */ ComponentCallbacks f19244a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4297d(ComponentCallbacks componentCallbacks, Qualifier aVar, AbstractC3435a aVar2) {
            super(0);
            this.f19244a = componentCallbacks;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [java.lang.Object, zi.a] */
        @Override // p189gn.AbstractC3435a
        public final PixivImageLoader invoke() {
            return C1124a.m10173s(this.f19244a).f24118a.m920a().m621a(Reflection.m5499a(PixivImageLoader.class), null, null);
        }
    }

    /* compiled from: ComponentCallbackExt.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.PixivNotificationsViewMoreActivity$e */
    /* loaded from: classes2.dex */
    public static final class C4298e extends Lambda implements AbstractC3435a<C5656z> {

        /* renamed from: a */
        public final /* synthetic */ ComponentCallbacks f19245a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4298e(ComponentCallbacks componentCallbacks, Qualifier aVar, AbstractC3435a aVar2) {
            super(0);
            this.f19245a = componentCallbacks;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [pk.z, java.lang.Object] */
        @Override // p189gn.AbstractC3435a
        public final C5656z invoke() {
            return C1124a.m10173s(this.f19245a).f24118a.m920a().m621a(Reflection.m5499a(C5656z.class), null, null);
        }
    }

    /* compiled from: ComponentCallbackExt.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.PixivNotificationsViewMoreActivity$f */
    /* loaded from: classes2.dex */
    public static final class C4299f extends Lambda implements AbstractC3435a<PixivNotificationsViewMoreStore> {

        /* renamed from: a */
        public final /* synthetic */ ComponentCallbacks f19246a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4299f(ComponentCallbacks componentCallbacks, Qualifier aVar, AbstractC3435a aVar2) {
            super(0);
            this.f19246a = componentCallbacks;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [java.lang.Object, pk.c0] */
        @Override // p189gn.AbstractC3435a
        public final PixivNotificationsViewMoreStore invoke() {
            return C1124a.m10173s(this.f19246a).f24118a.m920a().m621a(Reflection.m5499a(PixivNotificationsViewMoreStore.class), null, null);
        }
    }

    /* compiled from: ComponentCallbackExt.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.PixivNotificationsViewMoreActivity$g */
    /* loaded from: classes2.dex */
    public static final class C4300g extends Lambda implements AbstractC3435a<LegacyNavigation> {

        /* renamed from: a */
        public final /* synthetic */ ComponentCallbacks f19247a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4300g(ComponentCallbacks componentCallbacks, Qualifier aVar, AbstractC3435a aVar2) {
            super(0);
            this.f19247a = componentCallbacks;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [java.lang.Object, xi.a] */
        @Override // p189gn.AbstractC3435a
        public final LegacyNavigation invoke() {
            return C1124a.m10173s(this.f19247a).f24118a.m920a().m621a(Reflection.m5499a(LegacyNavigation.class), null, null);
        }
    }

    /* compiled from: ActivityExtension.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.PixivNotificationsViewMoreActivity$h */
    /* loaded from: classes2.dex */
    public static final class C4301h extends Lambda implements AbstractC3435a<String> {

        /* renamed from: a */
        public final /* synthetic */ Activity f19248a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4301h(Activity activity, String str) {
            super(0);
            this.f19248a = activity;
        }

        @Override // p189gn.AbstractC3435a
        public final String invoke() {
            Bundle extras = this.f19248a.getIntent().getExtras();
            if (extras != null) {
                Object obj = extras.get("title");
                Objects.requireNonNull(obj, "null cannot be cast to non-null type kotlin.String");
                return (String) obj;
            }
            throw new IllegalArgumentException("Required value was null.".toString());
        }
    }

    /* compiled from: ActivityExtension.kt */
    /* renamed from: jp.pxv.android.notification.presentation.activity.PixivNotificationsViewMoreActivity$i */
    /* loaded from: classes2.dex */
    public static final class C4302i extends Lambda implements AbstractC3435a<Long> {

        /* renamed from: a */
        public final /* synthetic */ Activity f19249a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4302i(Activity activity, String str) {
            super(0);
            this.f19249a = activity;
        }

        @Override // p189gn.AbstractC3435a
        public final Long invoke() {
            Bundle extras = this.f19249a.getIntent().getExtras();
            if (extras != null) {
                Object obj = extras.get("notification_id");
                Objects.requireNonNull(obj, "null cannot be cast to non-null type kotlin.Long");
                return (Long) obj;
            }
            throw new IllegalArgumentException("Required value was null.".toString());
        }
    }

    public PixivNotificationsViewMoreActivity() {
        super(R.layout.activity_pixiv_notifications_view_more);
    }

    /* renamed from: S0 */
    public static final void m4570S0(PixivNotificationsViewMoreActivity pixivNotificationsViewMoreActivity) {
        pixivNotificationsViewMoreActivity.m4566W0().f18228b.setVisibility(8);
    }

    /* renamed from: T0 */
    public static final void m4569T0(PixivNotificationsViewMoreActivity pixivNotificationsViewMoreActivity) {
        pixivNotificationsViewMoreActivity.m4566W0().f18229c.m4598a();
    }

    /* renamed from: U0 */
    public static final void m4568U0(PixivNotificationsViewMoreActivity pixivNotificationsViewMoreActivity) {
        pixivNotificationsViewMoreActivity.m4566W0().f18229c.m4598a();
    }

    /* renamed from: V0 */
    public final C5656z m4567V0() {
        return (C5656z) this.f19231x.getValue();
    }

    /* renamed from: W0 */
    public final ActivityPixivNotificationsViewMoreBinding m4566W0() {
        return (ActivityPixivNotificationsViewMoreBinding) this.f19230w.getValue();
    }

    /* renamed from: X0 */
    public final C4295b m4565X0(Notification notification) {
        PixivImageLoader aVar = (PixivImageLoader) this.f19229v.getValue();
        PixivDateTimeFormatter cVar = this.f19225E;
        if (cVar != null) {
            return new C4295b(aVar, cVar, m4567V0(), notification);
        }
        MutabilityOwnership.m3737u("pixivDateTimeFormatter");
        throw null;
    }

    @Override // androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.f19225E = new PixivDateTimeFormatter(this, C5453b.f24268a);
        MaterialToolbar materialToolbar = m4566W0().f18231e;
        MutabilityOwnership.m3746l(materialToolbar, "binding.toolBar");
        C0536v1.m11536i(this, materialToolbar, (String) this.f19221A.getValue());
        m4566W0().f18230d.setLayoutManager(this.f19227G);
        m4566W0().f18230d.setAdapter(this.f19223C);
        this.f19226F = new NotificationsDividerItemDecoration(this);
        RecyclerView recyclerView = m4566W0().f18230d;
        NotificationsDividerItemDecoration aVar = this.f19226F;
        if (aVar != null) {
            recyclerView.m10871g(aVar);
            Disposable g = subscribers.m2589g(((PixivNotificationsViewMoreStore) this.f19232y.getValue()).f24759e.m986o(AndroidSchedulers.m334a()), null, null, new p372nk.PixivNotificationsViewMoreActivity(this), 3);
            CompositeDisposable aVar2 = this.f19224D;
            MutabilityOwnership.m3744n(aVar2, "compositeDisposable");
            aVar2.mo82c(g);
            Disposable g2 = subscribers.m2589g(((PixivNotificationsViewMoreStore) this.f19232y.getValue()).f24760f.m986o(AndroidSchedulers.m334a()), null, null, new C5385q(this), 3);
            CompositeDisposable aVar3 = this.f19224D;
            MutabilityOwnership.m3744n(aVar3, "compositeDisposable");
            aVar3.mo82c(g2);
            C5656z V0 = m4567V0();
            long longValue = ((Number) this.f19222B.getValue()).longValue();
            String str = (String) this.f19221A.getValue();
            Objects.requireNonNull(V0);
            MutabilityOwnership.m3745m(str, "title");
            V0.f24845c.mo2437b(new FirebaseAnalyticsAction(new ScreenView(AnalyticsScreenName.PIXIV_NOTIFICATIONS_VIEW_MORE, Long.valueOf(longValue), str)));
            V0.f24845c.mo2437b(PixivNotificationsViewMoreAction.C5648d.f24836a);
            NotificationsRepository fVar = V0.f24846d.f22594a;
            Single<String> a = fVar.f20387a.mo1127a();
            C4546e eVar = new C4546e(fVar, longValue, 0);
            Objects.requireNonNull(a);
            Disposable e = subscribers.m2591e(new SingleDoOnSuccess(new SingleFlatMap(a, eVar), new C0146r(V0, 12)), new PixivNotificationsViewMoreActionCreator(V0), new C5651u(V0));
            CompositeDisposable aVar4 = V0.f24849g;
            MutabilityOwnership.m3744n(aVar4, "compositeDisposable");
            aVar4.mo82c(e);
            return;
        }
        MutabilityOwnership.m3737u("itemDecoration");
        throw null;
    }

    @Override // p116e.ActivityC2727f, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onDestroy() {
        this.f19224D.m80f();
        super.onDestroy();
    }

    @Override // androidx.activity.ComponentActivity, android.app.Activity
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        MutabilityOwnership.m3745m(menuItem, "item");
        if (menuItem.getItemId() != 16908332) {
            return super.onOptionsItemSelected(menuItem);
        }
        this.f940i.m12030b();
        return true;
    }
}
